'use strict';

import log from "@shenfengshan-cli/log"
import {isDebug} from "@shenfengshan-cli/helper"


const errorLog = (e, type) => log.error(type, isDebug ? e : e.message)
const catchError = () => {
    process.on("uncaughtException", (e) => errorLog(e, "error"))
    process.on('unhandledRejection', (e) => errorLog(e, 'promise'));
}

export {
    errorLog,
    catchError
}
